/*
* @Author: Iuzuan
* @Date:   2017-11-30 11:51:29
* @Last Modified by:   Iuzuan
* @Last Modified time: 2018-01-04 20:23:03
*/
$(function(){


// 菜单联动
$(function(){
   $(".menu li").on("click", function(){
     var typeName = $(this).data("typename")
     var sc=$(window).scrollTop();
     $('#' + typeName).animate({scrollTop:0},500);

     var itmHeight = $('#' + typeName).offset().top - 75
     $('body,html').animate({scrollTop:itmHeight},500);
   })
})

// 弹出下载二维码
$(".content").on('click', function(){
    Statistics("pc")
  $(".ecodePopBox").fadeIn()
})
$(".ecodePopBox .closeBtn").on('click', function(){

    Statistics("pc")
  $(".ecodePopBox").fadeOut()
})


    // 去官网
    $(".toWebsite").on('click', function(){
        toWebsite("http://www.zbqibing.com/jifen", window.location.href);
    })
    //下载地址
    $("#iphone").on("click", function(){
        Statistics("ios")
        window.open(getDownLoadUrl(window.location.href).ios)
    })
    $("#android").on("click", function(){
        Statistics("Android")
        window.location.href = getDownLoadUrl(window.location.href).android
    })

        // 视频播放控制
        $(".movie").css({
                    width: $(window).width(),
                    height: $(window).height()
                });
        $(".video-button").on("click",function(){
            $(".movie").fadeIn(400);
                var videoName = $(this).data("videoname")
                var videoResource

                switch(videoName)
                {
                  case "introduce":
                    videoResource = "http://video.zbqibing.com/fa9849c151de4f68ba1b05c42f64f533/d1625416614f409d907721c228182c5b-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "game":
                    videoResource = "http://video.zbqibing.com/112b38c074da42778575e4d9d984f720/56b2fe32f4f747859ddec058b9d17597-5456d705cfd07e668f702e78be66cb6f.mp4"
                    break;
                  case "zhuanshang":
                    videoResource = "http://video.zbqibing.com/404ce58f1fc0493b857fbc46ee512c70/125d46adb78b46f78689de239b4eb019-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "zengxiao":
                    videoResource = "http://video.zbqibing.com/371ad2955de5495ea8cc3af90b28f9ad/29d344afabec4fe39f849f7a33a498ae-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "xiaohao":
                    videoResource = "http://video.zbqibing.com/754f8ce331a44e629d097a01bbf41c0d/ccf617070d29457ba32dc28f7d27496e-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "wanduo":
                    videoResource = "http://video.zbqibing.com/17080317ff544da380c1d74485b0b315/253ca784995e414b9253d61d2ac2290d-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "toutian":
                    videoResource = "http://video.zbqibing.com/64528aebb7e141609b425d036884dd9c/3f789bdac9af4ed9a5f8b54efc1ac73a-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "shikong":
                    videoResource = "http://video.zbqibing.com/abe72af3ef39443ab191de561302e806/ffc8e6f2f6d745b3a28adda8044281a9-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "pofang":
                    videoResource = "http://video.zbqibing.com/80149c1a928b412d98ee2b56255e6515/57c7497d28fd4911ba4bee506089a128-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "juedou":
                    videoResource = "http://video.zbqibing.com/d88973a6b9904b1db1f27957d52181b4/f2b102df0f474a809e0372cadb549ddc-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "jingu":
                    videoResource = "http://video.zbqibing.com/c03fc1bc504440e3b1860a357ec21e8f/efb4677c95b14f1ba286089ed0a595c2-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "huanshi":
                    videoResource = "http://video.zbqibing.com/0059fbf63a09404fadad813bec18918b/f733aaa81c6b495da19f2b4111f3f809-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "duoyao":
                    videoResource = "http://video.zbqibing.com/2f997aaaae7044039de3759856d0abbc/547892d4ac8847899518c735acfc8e56-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  case "chihuan":
                    videoResource = "http://video.zbqibing.com/43f17a9e350b4e3b873421e1b35830d5/591668a53fc048c4b3f2d83f95cd46c4-bebed62c6b6ebe8977b46266f0584fdc.mp4"
                    break;
                  default:
                  
                }
                var src = videoResource
            $("#publicvideo").attr("src", src)
            // console.log($("video")[0].autoplay)
            $("#publicvideo")[0].play();
            $(".movie .movie-kuang").css({
                        height: $("#publicvideo").height()
                    });

        })          
        $(".movie-close-button").on("click",function(){
            $(".movie").fadeOut(400);
            $("#publicvideo")[0].pause();
        })

      // 懒加载部分
      console.log($(window).height())
      $("img.lazy").show().lazyload();
      $("img.lazy").lazyload();
      $("img.lazy").lazyload({
          threshold : $(window).height() + 10000
      });
      $("img.lazy").lazyload({
          effect : "fadeIn"
      });$("img.lazy").lazyload({
            failure_limit : 10
        });

if(getUrlParams(window.location.href).indexOf('from=19') >= 0){
  $('.hide').hide();
}

if(getUrlParams(window.location.href).indexOf('ad_from=19') >= 0){
  $('.hide').hide();
}

})